require 'test/unit'
require 'Modele/Parking'
require 'Modele/Vehicule'
require 'Modele/Client'
require 'Modele/Dbconect'
require 'Modele/Voiturier'

class VoiturierTest < Test::Unit::TestCase
  
  
  def test_livrer_vehicule_ok
     Dbconect.creationbd("test")
     parking = Parking.new("test",3)
     vehicule= Vehicule.new("123ABC31")
     client =Client.new("Folgueral","Thomas",parking)
     client.se_garer(vehicule,parking.acces[0].borne)  
     voiturier = Voiturier.new("gdfgdfn","Jean-pierre",parking)
     assert(voiturier.livrer_voiture(vehicule) != nil,"test_livrer_vehicule_ok fail")
   end
   
   def test_livrer_vehicule_pas_ok_immat
      Dbconect.creationbd("test")
      parking = Parking.new("test",3)
      vehicule= Vehicule.new("123ABC31")
      mauvaisvehicule= Vehicule.new("123ABC30")
      client =Client.new("Folgueral","Thomas",parking)
      client.se_garer(vehicule,parking.acces[0].borne)
      voiturier = Voiturier.new("gdfgdfn","Jean-pierre",parking)
      assert(voiturier.livrer_voiture(mauvaisvehicule) == nil,"test_livrer_vehicule_ok fail")
   end
  
  def test_livrer_vehicule_pas_ok_vehicule
     Dbconect.creationbd("test")
     parking = Parking.new("test",3)
    vehicule= Vehicule.new("123ABC31")
     client =Client.new("Folgueral","Thomas",parking)    
     voiturier = Voiturier.new("gdfgdfn","Jean-pierre",parking)
     assert(voiturier.livrer_voiture(vehicule) == nil,"test_livrer_vehicule_ok fail")
  end
end